/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package byzantine.controls.listeners;

import byzantine.ByzantineModel;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

/**
 *
 * @author Ryhan
 */
public class SliderListener implements ChangeListener {

    ByzantineModel model;

    public SliderListener(ByzantineModel model) {
        this.model = model;
    }

    public void stateChanged(ChangeEvent e) {
        JSlider source = (JSlider) e.getSource();
        if (!source.getValueIsAdjusting()) {
            int step = source.getValue();
            model.setExaminedStep(step);
        }
    }
}
